package com.sc.nft.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sc.nft.enums.ExpenditureRecordTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
@Data
public class MerchantViewBillVO {
    @ApiModelProperty("类型")
    private ExpenditureRecordTypeEnum type;
    @ApiModelProperty("类型名称")
    private String typeName;
    @ApiModelProperty("交易前余额")
    private String beforeBalance;
    @ApiModelProperty("交易后余额")
    private String afterBalance;
    @ApiModelProperty("交易后余额")
    private String amount;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("时间")
    private Date createTime;
    @JsonIgnore
    private Long orderId; // 用于获取 #firstTitle 值
    @ApiModelProperty("藏品名称")
    private String firstTitle;
    @ApiModelProperty("加减")
    private Boolean isAdd;
    @ApiModelProperty("图片")
    private String imageUrl;
    @ApiModelProperty("备注")
    private String remark;
    public void setBeforeBalance(BigDecimal beforeBalance) {
        this.beforeBalance = beforeBalance.setScale(2, BigDecimal.ROUND_DOWN).toPlainString();
    }
    public void setAfterBalance(BigDecimal afterBalance) {
        this.afterBalance = afterBalance.setScale(2, BigDecimal.ROUND_DOWN).toPlainString();
    }
    public void setAmount(BigDecimal amount) {
        this.amount = amount.setScale(2, BigDecimal.ROUND_DOWN).toPlainString();
    }
}
